<html>
<head><meta charset="utf-8"><title>not stripping a (c)dylib symbol · general · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/index.html">general</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/not.20stripping.20a.20(c)dylib.20symbol.html">not stripping a (c)dylib symbol</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="214804763"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/not%20stripping%20a%20%28c%29dylib%20symbol/near/214804763" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Giles Cope <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/not.20stripping.20a.20(c)dylib.20symbol.html#214804763">(Oct 28 2020 at 08:02)</a>:</h4>
<p>I'm focusing on an OSX dylib: I'm trying to embed the SVH into the library as a symbol as OSX dylibs have to have specific file names (so you can't just pop the SVH in the dylib name as you might be able to on other platforms). But at the moment my symbol is getting stripped out :-(</p>
<p>Apparently I problaby need to set S_ATTR_NO_DEAD_STRIP somehow in LLVM. I tried .section __DATA,.rust_svh_hash,no_dead_strip but no juice. This is my last stumbling block for my PR so any additonal hints are greatfully recieved!</p>



<a name="214804914"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/not%20stripping%20a%20%28c%29dylib%20symbol/near/214804914" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Giles Cope <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/not.20stripping.20a.20(c)dylib.20symbol.html#214804914">(Oct 28 2020 at 08:04)</a>:</h4>
<p>It looks like cdylib might be hard mode: <a href="https://github.com/rust-lang/rfcs/issues/2771">https://github.com/rust-lang/rfcs/issues/2771</a> but I'd be happy today if I can get the symbol to stay in a dylib.</p>



<a name="214805483"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/not%20stripping%20a%20%28c%29dylib%20symbol/near/214805483" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Giles Cope <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/not.20stripping.20a.20(c)dylib.20symbol.html#214805483">(Oct 28 2020 at 08:12)</a>:</h4>
<p>Hmm, a cdylib with panic=abort seems to have just two symbols in it: _rust_eh_personality and dyld_stub_binder. Let me have a snoop about as to how those are set up in rustc...</p>



<a name="214807869"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/not%20stripping%20a%20%28c%29dylib%20symbol/near/214807869" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Giles Cope <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/not.20stripping.20a.20(c)dylib.20symbol.html#214807869">(Oct 28 2020 at 08:43)</a>:</h4>
<p>Hmm, for dylib it's not even coming out in the .ll - at least that's still rust code :-)</p>



<a name="214854227"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/not%20stripping%20a%20%28c%29dylib%20symbol/near/214854227" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Giles Cope <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/not.20stripping.20a.20(c)dylib.20symbol.html#214854227">(Oct 28 2020 at 15:38)</a>:</h4>
<p>Got past dylib - got a symbol coming out now. Now for hard mode; somehow I need to get a symbol coming out for a cdylib so I'm covering all bases...</p>



<a name="214854346"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/not%20stripping%20a%20%28c%29dylib%20symbol/near/214854346" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/not.20stripping.20a.20(c)dylib.20symbol.html#214854346">(Oct 28 2020 at 15:39)</a>:</h4>
<p>Responded on the PR. The problem is likely that the metadata module is unused when compiling a cdylib.</p>



<a name="214864084"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/not%20stripping%20a%20%28c%29dylib%20symbol/near/214864084" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Giles Cope <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/not.20stripping.20a.20(c)dylib.20symbol.html#214864084">(Oct 28 2020 at 16:42)</a>:</h4>
<p>Hmm, "proc-macro crates are mostly cdylibs, but we also need metadata."</p>



<a name="214868939"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/not%20stripping%20a%20%28c%29dylib%20symbol/near/214868939" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Giles Cope <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/not.20stripping.20a.20(c)dylib.20symbol.html#214868939">(Oct 28 2020 at 17:16)</a>:</h4>
<p>Ideally I could just define it as an extern pub symbol and it would come out of the cdylib...</p>



<a name="214870147"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/not%20stripping%20a%20%28c%29dylib%20symbol/near/214870147" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Giles Cope <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/not.20stripping.20a.20(c)dylib.20symbol.html#214870147">(Oct 28 2020 at 17:24)</a>:</h4>
<p>Idk, maybe with rmeta, bin and dylibs having svh hashes in that's enough bin things with hashes in to focus on the cargo reading of the hashes side. I've got a lot further than I was expecting to so it's all good. (I worry slightly about introducing a whole metadata section into cdylibs just to sneak in a hash).</p>



<a name="214879107"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/not%20stripping%20a%20%28c%29dylib%20symbol/near/214879107" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/not.20stripping.20a.20(c)dylib.20symbol.html#214879107">(Oct 28 2020 at 18:28)</a>:</h4>
<p>I think it is fine to add a metadata section to cdylibs for as long as you ensure that the symbol will never cause a conflict and the amount of data in the section is very small.</p>



<a name="214937262"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/not%20stripping%20a%20%28c%29dylib%20symbol/near/214937262" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Giles Cope <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/not.20stripping.20a.20(c)dylib.20symbol.html#214937262">(Oct 29 2020 at 08:24)</a>:</h4>
<p>At least I don't think I have to worry about embedding a svh in a staticlib as that would be unlikely to be a dependency to any rust code so not intresting from an incremental compilation viewpoint. That said it might come out with the changes to support cdylib I guess...</p>



<a name="214938079"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/not%20stripping%20a%20%28c%29dylib%20symbol/near/214938079" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Giles Cope <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/not.20stripping.20a.20(c)dylib.20symbol.html#214938079">(Oct 29 2020 at 08:34)</a>:</h4>
<p>ok well got metadata coming out for cdylibs which is great - lots of symbols - in fact everything but my svh symbol. lol. Still it's progress!</p>



<a name="214944605"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/not%20stripping%20a%20%28c%29dylib%20symbol/near/214944605" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Giles Cope <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/not.20stripping.20a.20(c)dylib.20symbol.html#214944605">(Oct 29 2020 at 09:43)</a>:</h4>
<p>It's proving quite puzzling: encode_exported_symbols explicitly excludes the rust_metadata symbol and yet it still comes out in the dylib. I'm missing something and pretty sure now that that filtering isn't where it's coming out. Not lease because if I prevent it filtering out those symbols there the linker complains it can't export hidden symbols.</p>



<a name="214945327"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/not%20stripping%20a%20%28c%29dylib%20symbol/near/214945327" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/not.20stripping.20a.20(c)dylib.20symbol.html#214945327">(Oct 29 2020 at 09:49)</a>:</h4>
<p>It seems that the metadata symbol isn't actually exported from dylibs. Only the <code>.rustc</code> section is preserved in addition to two references to the origin object file.</p>
<div class="codehilite"><pre><span></span><code>$ bingrep ~/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/libstd-6e0e72ef3f331f94.so --color | rg &quot;\.rustc&quot;
  28    .rustc                 SHT_PROGBITS                      0xab60c0     0x0         0x2ebc44                  0x0       0x10
                 0    LOCAL      SECTION                                                                                                                                                                                                                                                                                                  0x0         .rustc(28)              0x0
                 0    GLOBAL     OBJECT      rust_metadata_std_4bb2e180944fd52bcd19320b64ef9850                                                                                                                                                                                                                                           0x2ebc44    .rustc(28)              0x0
                 0    GLOBAL     OBJECT      rust_metadata_std_4bb2e180944fd52bcd19320b64ef9850                                                                                                                                                                                                                                           0x2ebc44    .rustc(28)         0x0
          cb4380 X86_64_GLOB_DAT .rustc+0
</code></pre></div>



<a name="214996977"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/not%20stripping%20a%20%28c%29dylib%20symbol/near/214996977" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Giles Cope <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/not.20stripping.20a.20(c)dylib.20symbol.html#214996977">(Oct 29 2020 at 17:02)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/commit/f141acf0678139ac31375d02feebcc2be220715b">https://github.com/rust-lang/rust/commit/f141acf0678139ac31375d02feebcc2be220715b</a> - <span class="user-mention" data-user-id="133247">@bjorn3</span> ,  is it ok if I still keep the crate hash in the codegenResults as I haven't access to the type context to get it? I need to get the hash here: rustc_codegen_ssa/src/back/link.rs:381</p>



<a name="214997526"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/not%20stripping%20a%20%28c%29dylib%20symbol/near/214997526" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/not.20stripping.20a.20(c)dylib.20symbol.html#214997526">(Oct 29 2020 at 17:06)</a>:</h4>
<p>Is it possible to just keep the file with the correct prefix? If not, then re-adding the crate hash is fine.</p>



<a name="214997568"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/not%20stripping%20a%20%28c%29dylib%20symbol/near/214997568" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/not.20stripping.20a.20(c)dylib.20symbol.html#214997568">(Oct 29 2020 at 17:06)</a>:</h4>
<p>I just wanted the input to the linker code to be as small as possible.</p>



<a name="215001745"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/not%20stripping%20a%20%28c%29dylib%20symbol/near/215001745" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Giles Cope <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/not.20stripping.20a.20(c)dylib.20symbol.html#215001745">(Oct 29 2020 at 17:34)</a>:</h4>
<p>I'll re-add for now to get me back to a working state, and will revisit once I've proved that bin hashes work ok with cargo.</p>



<a name="215100835"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/not%20stripping%20a%20%28c%29dylib%20symbol/near/215100835" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Giles Cope <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/not.20stripping.20a.20(c)dylib.20symbol.html#215100835">(Oct 30 2020 at 14:22)</a>:</h4>
<p>ah rlibs are ar rather than tars. that helps.</p>



<a name="215129357"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/not%20stripping%20a%20%28c%29dylib%20symbol/near/215129357" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Giles Cope <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/not.20stripping.20a.20(c)dylib.20symbol.html#215129357">(Oct 30 2020 at 17:56)</a>:</h4>
<p>Ok, I think I've got to the debug it until it works stage. All the pieces (aside from cdylibs) are there. It's gonna be a fun one to write reliable tests for...</p>



<a name="215189136"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/not%20stripping%20a%20%28c%29dylib%20symbol/near/215189136" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/not.20stripping.20a.20(c)dylib.20symbol.html#215189136">(Oct 31 2020 at 12:20)</a>:</h4>
<p>Thinking about it a bit more, why do you need an svh for staticlibs, cdylibs and executables? They can't be used as dependency of other crates.</p>



<a name="215189138"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/not%20stripping%20a%20%28c%29dylib%20symbol/near/215189138" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/not.20stripping.20a.20(c)dylib.20symbol.html#215189138">(Oct 31 2020 at 12:20)</a>:</h4>
<p><span class="user-mention" data-user-id="120134">@Giles Cope</span> ^</p>



<a name="215241751"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/not%20stripping%20a%20%28c%29dylib%20symbol/near/215241751" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Giles Cope <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/not.20stripping.20a.20(c)dylib.20symbol.html#215241751">(Nov 01 2020 at 12:14)</a>:</h4>
<p>They can't? I hope executables will be able to be dylibs one day... but I take your point about staticlibs and cdylibs - rust code should not depend on them. Ok, well that makes things a little simpler. One thing I do think I need to sort out is I need to add svh into stand alone .rmeta files as those seem to be half of the dependencies along with .rlibs.</p>



<a name="215242354"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/not%20stripping%20a%20%28c%29dylib%20symbol/near/215242354" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/not.20stripping.20a.20(c)dylib.20symbol.html#215242354">(Nov 01 2020 at 12:31)</a>:</h4>
<p><span class="user-mention" data-user-id="120134">@Giles Cope</span> When executables get usable as dylibs, we must start to include the crate metadata in executables. When doing so, adding the SVH can be done at the same time.</p>



<a name="215242408"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/not%20stripping%20a%20%28c%29dylib%20symbol/near/215242408" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Giles Cope <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/not.20stripping.20a.20(c)dylib.20symbol.html#215242408">(Nov 01 2020 at 12:32)</a>:</h4>
<p>Thanks - just pondering how to pop svh into a .rmeta file now.</p>



<a name="215242413"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/not%20stripping%20a%20%28c%29dylib%20symbol/near/215242413" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/not.20stripping.20a.20(c)dylib.20symbol.html#215242413">(Nov 01 2020 at 12:32)</a>:</h4>
<p><a href="https://github.com/rust-lang/cargo/pull/8623#discussion_r515216749">https://github.com/rust-lang/cargo/pull/8623#discussion_r515216749</a></p>
<blockquote>
<p>This by the way gives me the idea of putting the svh at a stable location in the crate metadata. [...] (the rustc version is already included in a stable location for better error reporting when mixing rustc versions)</p>
</blockquote>
<p>Which is about the same as you suggested in <a href="https://github.com/rust-lang/rust/pull/75594#issuecomment-720081182">https://github.com/rust-lang/rust/pull/75594#issuecomment-720081182</a> just now.</p>



<a name="215242701"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/not%20stripping%20a%20%28c%29dylib%20symbol/near/215242701" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Giles Cope <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/not.20stripping.20a.20(c)dylib.20symbol.html#215242701">(Nov 01 2020 at 12:42)</a>:</h4>
<p>Sorry - it takes me a while for the penny to drop sometimes! That makes perfect sense - now to find out where the rustc version is included into the metadata. (I have one day left before I have to go back to work - really want to get this all working)</p>



<a name="215242794"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/not%20stripping%20a%20%28c%29dylib%20symbol/near/215242794" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/not.20stripping.20a.20(c)dylib.20symbol.html#215242794">(Nov 01 2020 at 12:44)</a>:</h4>
<p><span class="user-mention" data-user-id="120134">@Giles Cope</span> It can be found at</p>
<p><a href="https://github.com/rust-lang/rust/blob/1e37ba76d47280fa867c3863aa6d22376535637a/compiler/rustc_metadata/src/rmeta/mod.rs#L40-L54">https://github.com/rust-lang/rust/blob/1e37ba76d47280fa867c3863aa6d22376535637a/compiler/rustc_metadata/src/rmeta/mod.rs#L40-L54</a></p>
<p><a href="https://github.com/rust-lang/rust/blob/1e37ba76d47280fa867c3863aa6d22376535637a/compiler/rustc_metadata/src/rmeta/encoder.rs#L2038-L2042">https://github.com/rust-lang/rust/blob/1e37ba76d47280fa867c3863aa6d22376535637a/compiler/rustc_metadata/src/rmeta/encoder.rs#L2038-L2042</a></p>
<p><a href="https://github.com/rust-lang/rust/blob/1e37ba76d47280fa867c3863aa6d22376535637a/compiler/rustc_metadata/src/rmeta/encoder.rs#L2066-L2067">https://github.com/rust-lang/rust/blob/1e37ba76d47280fa867c3863aa6d22376535637a/compiler/rustc_metadata/src/rmeta/encoder.rs#L2066-L2067</a></p>



<a name="215242808"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/not%20stripping%20a%20%28c%29dylib%20symbol/near/215242808" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Giles Cope <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/not.20stripping.20a.20(c)dylib.20symbol.html#215242808">(Nov 01 2020 at 12:45)</a>:</h4>
<p>Golddust - many thanks!</p>



<a name="215243629"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/not%20stripping%20a%20%28c%29dylib%20symbol/near/215243629" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Giles Cope <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/not.20stripping.20a.20(c)dylib.20symbol.html#215243629">(Nov 01 2020 at 13:08)</a>:</h4>
<p>Given it's a fixed size I think putting it after the metadata version and before the rust version makes sense.</p>



<a name="215243656"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/not%20stripping%20a%20%28c%29dylib%20symbol/near/215243656" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Giles Cope <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/not.20stripping.20a.20(c)dylib.20symbol.html#215243656">(Nov 01 2020 at 13:09)</a>:</h4>
<p>Hmm, but that wouldn't be good for backward compatibility. Maybe after is better given that version is in a predictable location.</p>



<a name="215243699"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/not%20stripping%20a%20%28c%29dylib%20symbol/near/215243699" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/not.20stripping.20a.20(c)dylib.20symbol.html#215243699">(Nov 01 2020 at 13:10)</a>:</h4>
<p>You could keep supporting the error path for the current metadata version though.</p>



<a name="215243715"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/not%20stripping%20a%20%28c%29dylib%20symbol/near/215243715" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/not.20stripping.20a.20(c)dylib.20symbol.html#215243715">(Nov 01 2020 at 13:11)</a>:</h4>
<p>That would only give a bad error when trying to use crates compiled with a newer rustc version, but keeps the nice error when doing it the opposite way.</p>



<a name="215243752"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/not%20stripping%20a%20%28c%29dylib%20symbol/near/215243752" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/not.20stripping.20a.20(c)dylib.20symbol.html#215243752">(Nov 01 2020 at 13:12)</a>:</h4>
<p>It isn't common to mix both as cargo includes the rustc version in the <code>-Cextra-filename</code>.</p>



<a name="215243784"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/not%20stripping%20a%20%28c%29dylib%20symbol/near/215243784" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/not.20stripping.20a.20(c)dylib.20symbol.html#215243784">(Nov 01 2020 at 13:13)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/blob/ffe52882ed79be67344dd6085559e308241e7f60/compiler/rustc_metadata/src/locator.rs#L789">https://github.com/rust-lang/rust/blob/ffe52882ed79be67344dd6085559e308241e7f60/compiler/rustc_metadata/src/locator.rs#L789</a></p>
<p>It still gives a reasonable error when the metadata version is different.</p>



<a name="215254323"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/not%20stripping%20a%20%28c%29dylib%20symbol/near/215254323" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Giles Cope <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/not.20stripping.20a.20(c)dylib.20symbol.html#215254323">(Nov 01 2020 at 17:49)</a>:</h4>
<p>Adding it in after the rust version turned out to be pretty neat. Now .rlib and .rmeta all seem to be up to data when I move the target dir away and copy it back, but while that's nessisary it's not sufficient to figure out that there's no work to do. Those mtimes are used elsewhere...</p>



<a name="215254445"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/not%20stripping%20a%20%28c%29dylib%20symbol/near/215254445" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Giles Cope <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/not.20stripping.20a.20(c)dylib.20symbol.html#215254445">(Nov 01 2020 at 17:52)</a>:</h4>
<p>"old local fingerprints deps" and "dependency on <code>nom</code> is newer than we are" both seem like they're triggering the cascade of rebuilds...</p>



<a name="215254672"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/not%20stripping%20a%20%28c%29dylib%20symbol/near/215254672" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Giles Cope <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/not.20stripping.20a.20(c)dylib.20symbol.html#215254672">(Nov 01 2020 at 17:58)</a>:</h4>
<p>ok so first bit is for <a href="http://build.rs">build.rs</a> files. We knew that was going to take a little work to add in.</p>



<a name="215255694"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/not%20stripping%20a%20%28c%29dylib%20symbol/near/215255694" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Giles Cope <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/not.20stripping.20a.20(c)dylib.20symbol.html#215255694">(Nov 01 2020 at 18:26)</a>:</h4>
<p>"is newer than we are" is going to take a bit more thinking about - it's looking at an .rmeta file also. I'm going to sleep on this.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>